package main

import (
	"gateway/config"
	"gateway/engine"
	"go.uber.org/zap"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
	config.Logger.Info("Starting gateway...")
	engine.Initialize(config.RouteCfg)

	s := <-ch
	config.Logger.Info("Receive system signal", zap.String("signal", s.String()))

	engine.Destroy()
	config.Logger.Info("Stopped gateway")
}
